<template>
	<div>
		<v-button theme="primary" size="small" @click="edit">编辑</v-button>
		<v-button theme="danger" size="small" @click="remove">删除</v-button>
	</div>
</template>

<script>
	export default {
		data: () => ({
			id: 0,
			model: {},
			name: ""
		}),
		methods: {
		    reload() {
					this.$dispatch("reload");
				},
			  edit() {
					this.$dispatch("edit");
				},
				remove() {
					let self = this
					let name = this.model.roleName
					let data = {
						title: "删除角色",
						content: "您是否要删除角色" + name + "?"
					}
					Midway.confirm(data).then(function () {
						let _data = {
							roleId: self.model.roleId,
							mchtId: self.model.mchtId,
							brhId: self.model.brhNo
						}

						self.$post({
							url: "/api/v1" + projectName_Url + "/plat/role/"+ _data.roleId + '/'+ _data.mchtId,
							data: _data,
							method:"DELETE"
						}).then(response => {
							let message = {
								title: "操作提示",
								content: "成功删除角色"+name
							}
							Midway.alert(message);
							self.reload();
						},error => {});
					})
				}
		}
	}
</script>
